Skip to content

add ripple config object to Pressable#28156

Closed
vonovak wants to merge 4 commits intofacebook:masterfrom
vonovak:rippleCustomizationForPressable
Closed

add ripple config object to Pressable#28156
vonovak wants to merge 4 commits intofacebook:masterfrom
vonovak:rippleCustomizationForPressable

Conversation

@vonovak
Copy link
Copy Markdown
Contributor

@vonovak vonovak commented Feb 22, 2020

Summary

Motivation is to support ripple radius just like in TouchableNativeFeedback, plus borderless attribute. See #28009 (comment)

In the current form this means user needs to pass an android_ripple prop which is an object of this shape:

export type RippleConfig = {|
  color?: ?ColorValue,
  borderless?: ?boolean,
  radius?: ?number,
|};

Do we want to add methods that would create such config objects - https://facebook.github.io/react-native/docs/touchablenativefeedback#methods ?

Changelog

[Android] [Added] - support borderless and custom ripple radius on Pressable

Test Plan

Tested locally in RNTester. I noticed that when some content is rendered after the touchables, the ripple effect is "cut off" by the boundaries of the next view. This is not specific to Pressable, it happens to TouchableNativeFeedback too but I just didn't notice it before in #28009. As it is an issue of its own, I didn't investigate that.

pressable

I changed the Touchable example slightly too (I just moved the "custom ripple radius" up to show the "cutting off" issue), so just for completeness:

touchable

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 22, 2020
@react-native-bot react-native-bot added Platform: Android Android applications. Type: Enhancement A new feature or enhancement of an existing feature. labels Feb 22, 2020
@analysis-bot
Copy link
Copy Markdown

RNTester (Android/hermes/arm64-v8a): 3291136 bytes
RNTester (Android/hermes/armeabi-v7a): 3131392 bytes
RNTester (Android/hermes/x86): 3463168 bytes
RNTester (Android/hermes/x86_64): 3426304 bytes
RNTester (Android/jsc/arm64-v8a): 4446208 bytes
RNTester (Android/jsc/armeabi-v7a): 4268032 bytes
RNTester (Android/jsc/x86): 4360192 bytes
RNTester (Android/jsc/x86_64): 4646912 bytes

@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Feb 22, 2020

RNTester.app (iOS): 10727424 bytes

@analysis-bot
Copy link
Copy Markdown

RNTester (Android/hermes/arm64-v8a): 3291136 bytes
RNTester (Android/hermes/armeabi-v7a): 3131392 bytes
RNTester (Android/hermes/x86): 3463168 bytes
RNTester (Android/hermes/x86_64): 3426304 bytes
RNTester (Android/jsc/arm64-v8a): 4446208 bytes
RNTester (Android/jsc/armeabi-v7a): 4268032 bytes
RNTester (Android/jsc/x86): 4360192 bytes
RNTester (Android/jsc/x86_64): 4646912 bytes

@analysis-bot
Copy link
Copy Markdown

RNTester.app (iOS): 10657792 bytes

@vonovak vonovak marked this pull request as ready for review February 22, 2020 20:34
@vonovak vonovak requested a review from elicwhite February 22, 2020 20:34
Copy link
Copy Markdown
Member

@elicwhite elicwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! Just a couple nits

Comment thread Libraries/Components/Pressable/useAndroidRippleForView.js Outdated
Comment thread Libraries/Components/Pressable/useAndroidRippleForView.js Outdated
@vonovak vonovak requested a review from elicwhite February 23, 2020 20:28
@analysis-bot
Copy link
Copy Markdown

RNTester (Android/hermes/arm64-v8a): 3291136 bytes
RNTester (Android/hermes/armeabi-v7a): 3131392 bytes
RNTester (Android/hermes/x86): 3463168 bytes
RNTester (Android/hermes/x86_64): 3426304 bytes
RNTester (Android/jsc/arm64-v8a): 4446208 bytes
RNTester (Android/jsc/armeabi-v7a): 4268032 bytes
RNTester (Android/jsc/x86): 4360192 bytes
RNTester (Android/jsc/x86_64): 4646912 bytes

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheSavior has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Comment thread Libraries/Components/Pressable/useAndroidRippleForView.js Outdated
Comment thread Libraries/Components/Pressable/useAndroidRippleForView.js Outdated
@vonovak vonovak force-pushed the rippleCustomizationForPressable branch from 4ec8985 to 320effc Compare February 24, 2020 20:23
@analysis-bot
Copy link
Copy Markdown

RNTester (Android/hermes/arm64-v8a): 3291136 bytes
RNTester (Android/hermes/armeabi-v7a): 3131392 bytes
RNTester (Android/hermes/x86): 3463168 bytes
RNTester (Android/hermes/x86_64): 3426304 bytes
RNTester (Android/jsc/arm64-v8a): 4446208 bytes
RNTester (Android/jsc/armeabi-v7a): 4268032 bytes
RNTester (Android/jsc/x86): 4360192 bytes
RNTester (Android/jsc/x86_64): 4646912 bytes

@analysis-bot
Copy link
Copy Markdown

RNTester.app (iOS): 10657792 bytes

@vonovak vonovak requested a review from elicwhite February 24, 2020 20:49
Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheSavior has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Comment thread Libraries/Components/Pressable/useAndroidRippleForView.js Outdated
@analysis-bot
Copy link
Copy Markdown

RNTester (Android/hermes/arm64-v8a): 3291136 bytes
RNTester (Android/hermes/armeabi-v7a): 3131392 bytes
RNTester (Android/hermes/x86): 3463168 bytes
RNTester (Android/hermes/x86_64): 3426304 bytes
RNTester (Android/jsc/arm64-v8a): 4446208 bytes
RNTester (Android/jsc/armeabi-v7a): 4268032 bytes
RNTester (Android/jsc/x86): 4360192 bytes
RNTester (Android/jsc/x86_64): 4646912 bytes

@analysis-bot
Copy link
Copy Markdown

RNTester.app (iOS): 10657792 bytes

Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheSavior has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@vonovak vonovak force-pushed the rippleCustomizationForPressable branch from 2452982 to d44beb5 Compare March 17, 2020 23:30
Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheSavior has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@elicwhite
Copy link
Copy Markdown
Member

Heads up @kikisaints that we are working on landing this change to the Pressable API.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @vonovak in bd38686.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Apr 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: Android Android applications. Type: Enhancement A new feature or enhancement of an existing feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants